package com.briup.web;

import com.briup.util.ResponseUtil;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class IPcheck {
    @GetMapping("/IPcheck")
    public ResponseUtil IPcheck(String ip){

        String Url="http://apis.juhe.cn/ip/ipNew?ip={ip}&key=b0d87fe9b21094ad27160fb15a91d3c1";
        RestTemplate restTemplate =new RestTemplate();
        ResponseEntity responseEntity =restTemplate.getForEntity(Url,String.class,ip);
        String str = (String) responseEntity.getBody();
        ResponseUtil responseUtil = ResponseUtil.ok(str);
        return responseUtil;
    }

}